package com.example.design.shejimoshi.structure.flyweight.demo01;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description 棋局
 * @date 2022/10/25 16:03
 * @Author liuzhihui
 * @Version 1.0
 */
public class ChessBoard {
    private Map<Integer, ChessPiece> chessPieces = new HashMap<>();

    public ChessBoard() {
        init();
    }

    // 初始化棋局
    private void init() {
        chessPieces.put(1, new ChessPiece(ChessPieceUnitFactory.getChessPieceUnit(1), 0, 0));
        chessPieces.put(1, new ChessPiece(ChessPieceUnitFactory.getChessPieceUnit(2), 1, 0));
        //...省略摆放其他棋子的代码...
    }

    public void move(int chessPieceId, int toPositionX, int toPositionY) {
        //...省略...
    }

}
